<template>
  <div>
    <group title="已开通城市">
      <cell v-for="city in citys" :title="city.cityName" is-link @click="selectCity(city)"></cell>
    </group
  </div>
</template>
<script>
  import {Group, Cell} from './../../components'
  import { showBigGift, selectAddressStatus, bigGifts } from './../../vuex/getters.js'
  import { set_showBigGift, set_selectAddressStatus, set_bigGift } from './../../vuex/actions.js'
  var MyRequest = require('./../../commons/js/MyRequest.js')
  var LocalStorageUtil = require('./../../commons/js/LocalStorageUtil.js')
  var Global = require("./../../commons/js/Global.js")
  export default {
    data () {
      return {
        citys: ""
      }
    },
    components: {
      Group,
      Cell
    },
    vuex: {
      getters: {
        showBigGift,
        selectAddressStatus, 
        bigGifts 
      },
      actions: {
        set_showBigGift,
        set_selectAddressStatus, 
        set_bigGift
      }
    },
    created: function() {
      var data = {
        action: "list"
      }
      MyRequest.MyGetWithToast("Citys", this, function (result, that) {
        that.citys = result.data
        Global.closeLoading()
      }, data)
    },
    methods: {
      selectCity (city) {
        var newCity = {
          id : city.id,
          cityName : city.cityName
        }
        LocalStorageUtil.setItem("city", newCity)
        this.$router.go({ path: '/register' })
      }
    }
  }  
</script>
<style>

</style>